import {request } from 'ice';
import {API_LOGIN_URL} from './ApiUrl'
import {getCookieBBT, getBBTKey} from '@/utils/cookie'

/**
 * 登录接口
 */
async function login(params) {
    try {
        console.log('API 打印参数：',params);
        const response = await request.post(API_LOGIN_URL.API_LOGIN, params,{
          withFullResponse: true // 服务端响应头全部返回
        });
        return response;
    } catch (error) {
      console.error(error);
    }
  }

async function loginByCookie() {
    try {
        const headerParam ={}
        headerParam[getBBTKey()] = getCookieBBT();
        const data = await request.post(API_LOGIN_URL.API_LOGIN_COOKIE, null, {
          headers: headerParam
        });
        return data;
    } catch (error) {
      console.error(error);
    }
  }
  export {login, loginByCookie}